var MT = window.MT || {};
MT.namespace = function () {
    var a = arguments, o = null, i, j, d;
    for (i = 0; i < a.length; ++i) {
        d = a[i].split(".");
        o = MT;
        for (j = (d[0] == "MT") ? 1 : 0; j < d.length; ++j) {
            o[d[j]] = o[d[j]] || {};
            o = o[d[j]];
        }
    }
    return o;
};
MT.namespace("util", "app", "widget");
(function () {
    var $C = YAHOO.util.Connect;
    var $D = YAHOO.util.Dom;
    var $E = YAHOO.util.Event;
    var _9 = YAHOO.util.KeyListener;
    var _a = YAHOO.env.ua.ie;
    var _b = (_a == 6);
    var _c = YAHOO.env.ua.gecko;
    var _d = YAHOO.env.ua.webkit;
    var _e = YAHOO.env.ua.opera;
    var _f = YAHOO.lang.isString;
    var _10 = YAHOO.lang.trim;
    MT.util = {
        breakWord: function (el) {
            el = $D.get(el);
            if (!el || el.nodeType !== 1) {
                return false;
            }
            if (el.currentStyle && typeof el.currentStyle.wordBreak === "string") {
                el.runtimeStyle.wordBreak = "break-all";
                return true;
            }
            else {
                if (document.createTreeWalker) {
                    var _12 = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
                    var _13, s, c = String.fromCharCode("8203");
                    while (_12.nextNode()) {
                        _13 = _12.currentNode;
                        s = _10(_13.nodeValue).split("").join(c);
                        _13.nodeValue = s;
                    }
                    return true;
                }
                else {
                    return false;
                }
            }
        },
        fixTextareaCursorPosition: function (_16) {
            if (_f(_16)) {
                _16 = $D.get(_16);
            }
            if (_a || _e) {
                var rng = _16.createTextRange();
                rng.text = _16.value;
                rng.collapse(false);
            }
            else {
                if (_d) {
                    _16.select();
                    window.getSelection().collapseToEnd();
                }
            }
        },
        focusTextarea: function (_18) {
            try {
                _18.focus();
                this.fixTextareaCursorPosition(_18);
            }
            catch (e) { }
        },
        checkCapsLock: function (e) {
            e = (e) ? e : window.event;
            var _1a = false;
            if (e.which) {
                _1a = e.which;
            }
            else {
                if (e.keyCode) {
                    _1a = e.keyCode;
                }
            }
            var _1b = false;
            if (e.shiftKey) {
                _1b = e.shiftKey;
            }
            else {
                if (e.modifiers) {
                    _1b = !!(e.modifiers & 4);
                }
            }
            if (_1a >= 97 && _1a <= 122 && _1b) {
                return true;
            }
            if (_1a >= 65 && _1a <= 90 && !_1b) {
                return true;
            }
            return false;
        },
        getEvalRes: function (o, _1d) {
            try {
                return eval("(" + o.responseText + ")");
            }
            catch (ex) {
                return { "status": 0, "msg": _1d || "\u7f51\u7edc\u6709\u95ee\u9898\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\u3002" };
            }
        },
        decodeJSON: function (str) {
            try {
                return eval("(" + str + ")");
            }
            catch (ex) {
                return null;
            }
        },
        ctrlEnter: function (el, _20) {
            var _21 = new YAHOO.util.KeyListener(el, {
                ctrl: true, keys: [13, 100]
            }, function () {
                _20();
                _21.disable();
                window.setTimeout(function () {
                    _21.enable();
                }, 2000);
            }
);
            _21.enable();
        }, yFadeRemove: function (_22, _23) {
            var p = $D.getAncestorByTagName(_22, _23);
            if (!p) {
                return;
            }
            MT.util.Effect.yellowFadeOut(p, function (el) {
                el.parentNode.removeChild(el);
                if (_a) {
                    MT.util.reFlow();
                }
            }
);
        }, reFlow: function () {
            if (_a) {
                document.body.style.zoom = 1.1;
                document.body.style.zoom = "";
            }
        }, getLength: function (str) {
            if (!str) {
                return 0;
            }
            for (var i = 0, _28 = 0, len = str.length; i < len; i++) {
                _28 = str.charCodeAt(i) > 255 ? _28 + 2 : _28 + 1;
            }
            return _28;
        }, toFull: function (str) {
            var ret = "";
            for (var i = 0, len = str.length; i < len; i++) {
                var _2e = str.charCodeAt(i);
                if (_2e == 32) {
                    ret += String.fromCharCode(12288);
                }
                else {
                    if (_2e < 127) {
                        ret += String.fromCharCode(_2e + 65248);
                    }
                    else {
                        ret += str[i];
                    }
                }
            }
            return ret;
        }, toHalf: function (str) {
            var ret = "";
            for (var i = 0, len = str.length; i < len; i++) {
                var _33 = str.charCodeAt(i);
                if (_33 == 12288) {
                    ret += String.fromCharCode(32);
                }
                else {
                    if (_33 > 65280 && _33 < 65375) {
                        ret += String.fromCharCode(_33 - 65248);
                    }
                    else {
                        ret += String.fromCharCode(_33);
                    }
                }
            }
            return ret;
        }, toPostData: function (o) {
            var arr = [];
            for (var i in o) {
                arr.push(i + "=" + o[i]);
            }
            return arr.join("&");
        }, parseStr: function (str) {
            if (!str) {
                return null;
            }
            var arr = str.split("&");
            var ret = {};
            for (var i = 0, len = arr.length; i < len; i++) {
                var tmp = arr[i].split("=");
                ret[tmp[0]] = tmp[1];
            }
            return ret;
        }, loadImage: function (src) {
            var img = new Image();
            img.src = src;
        }, pad: function (num, _40, _41) {
            if (!_41) {
                _41 = "0";
            }
            var len = num.toString().length;
            while (len < _40) {
                num = _41 + num; len++;
            }
            return num;
        }, parseDate: function (_43) {
            var tmp = _43.split(" ");
            var _45 = tmp[1] + " " + tmp[2] + ", " + tmp[5] + " " + tmp[3];
            return Date.parse(_45) - (new Date()).getTimezoneOffset() * 60 * 1000;
        }, getRelativeTime: function (_46) {
            var _47 = _f(_46) ? this.parseDate(_46).valueOf() : _46;
            var now = new Date();
            var _49 = parseInt((now.getTime() - _47) / 1000, 10);
            if (_49 < 1) {
                return "1 \u79d2\u524d";
            }
            else {
                if (_49 < 60) {
                    return _49 + " \u79d2\u524d";
                }
                else {
                    if (_49 < 60 * 60) {
                        return parseInt(_49 / 60, 10) + " \u5206\u949f\u524d";
                    }
                    else {
                        if (_49 < 60 * 60 * 24) {
                            return "\u7ea6 " + parseInt(_49 / 3600, 10) + " \u5c0f\u65f6\u524d";
                        }
                        else {
                            return this.getFullTime(_46);
                        }
                    }
                }
            }
        }, getFullTime: function (_4a) {
            var d = new Date(_f(_4a) ? this.parseDate(_4a) : _4a);
            var _4c = d.getFullYear();
            var _4d = this.pad(d.getMonth() + 1, 2);
            var _4e = this.pad(d.getDate(), 2);
            var _4f = this.pad(d.getHours(), 2);
            var _50 = this.pad(d.getMinutes(), 2);
            return _4c + "-" + _4d + "-" + _4e + " " + _4f + ":" + _50;
        }, getText: function (el) {
            if (_f(el)) {
                el = $D.get(el);
            }
            var _52 = el.innerText || el.textContent;
            return _10(_52);
        }, getRadioValue: function (_53, _54) {
            if (_f(_53)) {
                _53 = $D.get(_53);
            }
            var r = _53[_54];
            if (!r) {
                return null;
            }
            var n = r.length;
            if (n) {
                for (var i = 0; i < n; ++i) {
                    if (r[i].checked) {
                        return r[i].value;
                    }
                }
            }
            return r.value;
        }, fixIE6Png: function (_58) {
            if (!_b) {
                return;
            }
            if (_f(_58)) {
                _58 = $D.get(_58);
            }
            var reg = /.png$/i;
            $D.getElementsBy(function (img) {
                return reg.test(img.src);
            }, "img", _58, function (img) {
                img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + img.src + "\", sizingMethod=\"crop\");";
                img.src = "/static/img/importantblk.gif";
            });
        }, inArray: function (_5c, _5d, _5e) {
            var key = "", _60 = !!_5e;
            if (_60) {
                for (key in _5d) {
                    if (_5d[key] === _5c) {
                        return true;
                    }
                }
            }
            else {
                for (key in _5d) {
                    if (_5d[key] == _5c) {
                        return true;
                    }
                }
            }
            return false;
        }, getCommonDialog: function (id, _62) {
            var _63 = {
                width: "400px", fixedcenter: true, close: false, draggable: false, zindex: 7, modal: true, visible: false
            };
            for (var i in _62) {
                _63[i] = _62[i];
            }
            var _65 = new YAHOO.widget.Panel(id, _63);
            _65.showEvent.subscribe(function () {
                $D.getElementsByClassName("close", "*", id, function (el) {
                    $E.on(el, "click", function () {
                        _65.hide();
                    });
                });
            });
            _65.setContent = function (_67) {
                this.setBody("<div class=\"common-dialog\">" + _67 + "</div>");
            };
            _65.fixOverlay = function () {
                if (_b || (_a == 7 && document.compatMode == "BackCompat")) {
                    this.sizeUnderlay();
                }
            };
            _65.open = function () {
                this.render(document.body);
                this.show();
            };
            return _65;
        }, Effect: {
            _yfade: function (el, _69, _6a, _6b) {
                var a = arguments, f = "#fff478", t = "#ffffff", cb;
                if (YAHOO.lang.isArray(a[2])) {
                    f = a[2][0] ? a[2][0] : f;
                    t = a[2][1] ? a[2][1] : t;
                }
                else {
                    if (YAHOO.lang.isFunction(a[2])) {
                        cb = a[2];
                    }
                }
                if (YAHOO.lang.isFunction(a[3])) {
                    cb = a[3];
                }
                var opa = _69 == "out" ? { from: 1, to: 0} : { from: 0, to: 1 };
                var _71 = new YAHOO.util.ColorAnim(el, { backgroundColor: { from: f, to: t }, opacity: opa }, 1, YAHOO.util.Easing.easeNone);
                if ("undefined" != typeof cb) {
                    _71.onComplete.subscribe(function () {
                        cb(el);
                    });
                }
                _71.animate();
                return _71;
            }, yellowFadeOut: function (el, _73, _74) {
                return MT.util.Effect._yfade(el, "out", _73, _74);
            }, yellowFadeIn: function (el, _76, _77) {
                return MT.util.Effect._yfade(el, "in", _76, _77);
            }
        }, Cookie: {
            getExpiresDate: function (_78, _79, _7a) {
                var _7b = new Date();
                if (typeof _78 == "number" && typeof _79 == "number" && typeof _79 == "number") {
                    _7b.setDate(_7b.getDate() + parseInt(_78, 10));
                    _7b.setHours(_7b.getHours() + parseInt(_79, 10));
                    _7b.setMinutes(_7b.getMinutes() + parseInt(_7a, 10));
                    return _7b.toGMTString();
                }
            }, _getValue: function (_7c) {
                var _7d = document.cookie.indexOf(";", _7c);
                if (_7d == -1) {
                    _7d = document.cookie.length;
                }
                return unescape(document.cookie.substring(_7c, _7d));
            }, get: function (_7e) {
                var arg = _7e + "=";
                var _80 = arg.length;
                var _81 = document.cookie.length;
                var i = 0;
                while (i < _81) {
                    var j = i + _80;
                    if (document.cookie.substring(i, j) == arg) {
                        return this._getValue(j);
                    }
                    i = document.cookie.indexOf(" ", i) + 1;
                    if (i === 0) {
                        break;
                    }
                }
                return "";
            }, set: function (_84, _85, _86, _87, _88, _89) {
                document.cookie = _84 + "=" + escape(_85) + ((_86) ? "; expires=" + _86 : "") + ((_87) ? "; path=" + _87 : "") + ((_88) ? "; domain=" + _88 : "") + ((_89) ? "; secure" : "");
            }, remove: function (_8a, _8b, _8c) {
                if (this.get(_8a)) {
                    document.cookie = _8a + "=" + ((_8b) ? "; path=" + _8b : "") + ((_8c) ? "; domain=" + _8c : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
                }
            }, clear: function () {
                var _8d = document.cookie.split(";");
                for (var i = 0; i < _8d.length; i++) {
                    this.remove(_10(_8d[i].split("=")[0]), "/", "mt.com");
                    this.remove(_10(_8d[i].split("=")[0]), "/", "kxapp.mt.com");
                }
            }
        }
    };
    MT.widget = {
        selectAndCopy: function (_8f, _90, _91) {
            if (_f(_8f)) {
                _8f = $D.get(_8f);
            }
            var _92 = "flashcopier", _93 = "flashembed";
            function copy(_94) {
                if (!$D.get(_92)) {
                    var _95 = document.createElement("div");
                    _95.id = _92; document.body.appendChild(_95);
                }
                var _96 = $D.get(_92); _96.innerHTML = "<embed src=\"http://static.fanfou.com/swf/cp.swf\" FlashVars=\"clipboard=" + encodeURIComponent(_94.value) + "\" width=\"0\" height=\"0\" type=\"application/x-shockwave-flash\" id=\"" + _93 + "\"></embed>";
                var _97 = window[_93] || document[_93] || {};
                if (!_97.SetVariable) {
                    try {
                        return window.clipboardData.setData("Text", _94.value);
                    }
                    catch (exx) {
                        return false;
                    }
                }
                return true;
            }
            $E.on(_8f, "click", doCopy);
            $E.on(_90, "click", doCopy);
            function doCopy() {
                if (_a && copy(_8f)) {
                    alert(_91 || "\u590d\u5236\u6210\u529f\uff0c\u4f60\u53ef\u4ee5\u7c98\u5e16\u5230MSN\u6216QQ\u4e2d\u53d1\u7ed9\u597d\u53cb\u3002");
                }
                setTimeout(function () {
                    _8f.select();
                }, 0);
            }
        }, showMessage: function (_98, _99) {
            var _9a = $D.getElementsByClassName("sysmsgw", "div", "doc");
            if (_9a.length) {
                _9a = _9a[0];
            }
            else {
                _9a = document.createElement("div");
                _9a.className = "sysmsgw";
                _9a.innerHTML = "<div class=\"sysmsg\"><p></p><span class=\"close\" onclick=\"MT.app.Core.removeFromCloseButton(this)\">\u5173\u95ed</span></div>";
                $D.insertAfter(_9a, "hdw");
            }
            _9a.id = "sysmsg-" + _98;
            var p = _9a.getElementsByTagName("p")[0];
            p.innerHTML = _99;
        }, removeMessage: function () {
            var _9c = $D.getElementsByClassName("sysmsgw", "div", "doc");
            if (_9c.length) {
                _9c = _9c[0];
                _9c.parentNode.removeChild(_9c);
            }
        }, _makeCouponSMSForm: function (_9d, _9e) {
            var _9f = document.createElement("form");
            _9e = _9e ? _9e : "";
            _9f.style.display = "none";
            var _a0 = "<div><input type=\"text\" class=\"f-input\" name=\"mobile\" maxlength=\"11\" value=\"" + _9e + "\" autocomplete=\"off\" /><br /><input type=\"submit\" class=\"formbutton";
            if (!_9e) {
                _a0 += " disabled\" disabled=\"disabled\"";
            }
            _a0 += "\" value=\"\u53d1\u9001\" /></div><p></p>";
            _9f.innerHTML = _a0;
            var _a1 = $D.getElementsByClassName("f-input", "input", _9f)[0];
            var _a2 = $D.getElementsByClassName("formbutton", "input", _9f)[0];
            var div = _9f.getElementsByTagName("div")[0];
            var p = _9f.getElementsByTagName("p")[0];
            function check(e) {
                if (/^[0-9]{11}$/.test(_a1.value)) {
                    _a2.disabled = false;
                    $D.removeClass(_a2, "disabled");
                }
                else {
                    _a2.disabled = true;
                    $D.addClass(_a2, "disabled");
                }
            }
            $E.on(_a1, "keyup", check);
            $E.on(_a1, "change", check);
            $E.on(_9f, "submit", function (e) {
                $E.stopEvent(e);
                $C.setForm(_9f);
                var _a7 = $C.asyncRequest("POST", "/coupon/sms/" + _9d, {
                    success: function (o) {
                        var ret = MT.util.getEvalRes(o, "\u672a\u77e5\u9519\u8bef");
                        div.style.display = ret.status == 1 ? "none" : "block";
                        p.style.display = "block";
                        var _aa = ret.status == 1 ? "sendsms-success" : "sendsms-failure";
                        p.innerHTML = "<span class=\"" + _aa + "\">" + ret.msg + "</span>";
                    }, failure: function (o) {
                        div.style.display = "block";
                        p.style.display = "block";
                        p.innerHTML = "<span class=\"sendsms-failure\">\u8fde\u63a5\u8d85\u65f6</span>";
                    }, timeout: 18000
                });
                if ($C.isCallInProgress(_a7)) {
                    div.style.display = "none";
                    p.innerHTML = "<img src=\"/static/css/i/indicator-large.gif\">";
                }
            }
);
            return _9f;
        }, sendCouponSMS: function (el, _ad, _ae) {
            var _af = el.parentNode.getElementsByTagName("form");
            if (_af.length) {
                _af = _af[0];
            }
            else {
                _af = this._makeCouponSMSForm(_ad, _ae);
                el.parentNode.appendChild(_af);
            }
            if (_af.style.display == "none") {
                _af.style.display = "block";
                try {
                    _af.mobile.focus();
                }
                catch (e) { }
            }
            else {
                _af.style.display = "none";
            }
        }, startMsnChat: function (_b0) {
            try {
                window.setTimeout(function () {
                    var frm = document.createElement("form");
                    $D.get("doc").appendChild(frm);
                    frm.method = "post";
                    frm.action = "msnim:chat?contact=" + _b0;
                    frm.submit();
                }, 100);
            }
            catch (e) {
                alert(e);
            }
        }
    };
    MT.app.Core = {
        removeFromCloseButton: function (_b2) {
            var p = $D.getAncestorByClassName(_b2, "sysmsgw");
            p.parentNode.removeChild(p);
        }, removeTip: function () {
            var _b4 = $D.get("sysmsg-tip");
            var _b5 = $D.get("sysmsg-tip-close");
            if (!_b4 || !_b5) {
                return;
            }
            $E.on(_b5, "click", function (e) {
                _b4.parentNode.removeChild(_b4);
            });
        }, sysmsg: function () {
            this.removeTip();
            var _b7 = $D.get("sysmsg-error");
            if (!_b7) {
                _b7 = $D.get("sysmsg-success");
            }
            if (!_b7) {
                return;
            }
            $D.getElementsByClassName("close", "span", _b7, function (el) {
                $E.on(el, "click", function (e) {
                    MT.app.Core.removeFromCloseButton(el);
                });
            });
        }, initAccountMenu: function () {
            var _ba = $D.get("myaccount");
            var _bb = $D.get("myaccount-menu");
            $E.on(_ba, "click", function (e) {
                _ba.blur();
                var _bd = this.getAttribute("isuc");
                if (!_bd) {
                    $E.stopEvent(e);
                }
            });
            $E.on(_ba, "mouseover", function (e) {
                _bb.style.display = "block";
            });
            $E.on(_ba, "mouseout", function (e) {
                handleOut(e);
            });
            $E.on(_bb, "mouseout", function (e) {
                handleOut(e);
            });
            function handleOut(e) {
                var _c2 = $E.getTarget(e);
                var _c3 = $E.getRelatedTarget(e);
                if (_bb == _c3 || $D.isAncestor(_bb, _c3)) {
                    $D.addClass(_ba, "hover");
                }
                else {
                    $D.removeClass(_ba, "hover");
                    _bb.style.display = "none";
                }
            }
        }, changeCity: function () {
            var _c4 = $D.get("header-city");
            var _c5 = $D.get("guides-city-list");
            if (!_c4 || !_c5) {
                return;
            }
            $E.on(_c4, "click", function (e) {
                if ($D.getStyle(_c5, "display") == "none") {
                    _c4.className = "unfold";
                    _c5.style.display = "block";
                    _gaq.push(["_trackEvent", "InnerLink", "Click", "/CitySelector/click"]);
                }
                else {
                    _c4.className = "fold";
                    _c5.style.display = "none";
                }
            });
            $E.on(document, "click", function (e) {
                var _c8 = $E.getTarget(e);
                var _c9 = _c8.nodeName.toLowerCase();
                if (_c8 != _c4 && _c8 != _c5 && !$D.isAncestor(_c4, _c8) && !$D.isAncestor(_c5, _c8)) {
                    window.setTimeout(function () {
                        _c4.className = "fold";
                        _c5.style.display = "none";
                    }, 10);
                }
            });
        }, msnHelp: function () {
            var _ca = "custom-service-dialog";
            var _cb = MT.util.getCommonDialog(_ca, { width: "420px" });
            var _cc = null;
            var _cd = 15;
            $E.on(["service-msn-help", "service-qq-help"], "click", function (e) {
                $E.stopEvent(e);
                this.blur();
                var _cf = this.getAttribute("stype");
                var msn = this.getAttribute("saddress");
                if (_a) {
                    if (_cf == "msn") {
                        MT.widget.startMsnChat(msn);
                    }
                    else {
                        if (_cf == "qq") {
                            var url = this.getAttribute("surl");
                            window.open(url, "_blank", "height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no");
                        }
                    }
                }
                else {
                    showDialog(_cf, msn);
                }
            });
            function showDialog(_d2, _d3) {
                var _d4 = ["<div class=\"\">"];
                _d4.push("<h3 class=\"head\">\u5ba2\u670d" + (_d2 == "msn" ? "MSN" : "QQ") + "<span class=\"close\">\u5173\u95ed</span></h3>");
                _d4.push("<div class=\"body\">");
                if (_d2 == "msn") {
                    _d4.push("<p>\u62b1\u6b49\uff0c\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u517c\u5bb9\u5ba2\u670dMSN\u3002<br />\u60a8\u53ef\u4ee5\u52a0 <strong>" + _d3 + "</strong> \u4e3a\u597d\u53cb\uff0c\u518d\u8fdb\u884c\u54a8\u8be2\u3002</p>");
                }
                else {
                    _d4.push("<p>\u62b1\u6b49\uff0c\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u517c\u5bb9\u5ba2\u670dQQ\u3002<br />\u60a8\u53ef\u4ee5\u52a0 <strong>" + _d3 + "</strong> \u4e3a\u597d\u53cb\uff0c\u518d\u8fdb\u884c\u54a8\u8be2\u3002</p>");
                }
                _d4.push("</div></div>");
                $D.addClass(document.body, "yui-skin-sam");
                _cb.hideEvent.subscribe(function () {
                    window.clearTimeout(_cc);
                });
                _cb.setContent(_d4.join(""));
                _cb.open();
                _cc = window.setTimeout(function () {
                    _cb.hide();
                }, _cd * 1000);
            }
        }, trackGAEvent: function () {
            var _d5 = "gaevent";
            var _d6 = "galabel";
            $E.on(document, "click", function (e) {
                var _d8 = $E.getTarget(e);
                var _d9 = _d8.nodeName.toLowerCase();
                trackCustomEvent(_d8);
                if (_d9 === "a") {
                    trackOutLink(_d8);
                }
            });
            function trackCustomEvent(el) {
                var _db = el.getAttribute(_d5);
                if (!_db) {
                    return;
                }
                var _dc = _db.split("|");
                var _dd = _dc[0];
                var _de = _dc[1];
                var _df = _dc[2];
                var _e0 = _dc[3];
                if (!_df && el.href) {
                    _df = el.href.replace("http://", "");
                }
                _gaq.push(["_trackEvent", _dd, _de, _df, _e0]);
            }
            function trackOutLink(el) {
                var _e2 = el.href;
                var reg = /^(http:\/\/|mailto:)/; if (_e2 && reg.test(_e2)) {
                    _e2 = _e2.replace("http://", ""); var _e4 = _e2.indexOf("?");
                    var _e5 = el.getAttribute(_d6);
                    if (_e4 > 0) {
                        _e2 = _e2.substring(0, _e4);
                    }
                    if (/\.(meituan|mt|fdpmt)\.com/.test(_e2)) {
                        return;
                    }
                    if (_e5) {
                        _e2 += "#label=" + _e5;
                    }
                    _gaq.push(["_trackEvent", "OutLink", "Click", _e2]);
                }
            }
        }, _subscribedDialog: null, getSubscribedDialog: function () {
            if (!this._subscribedDialog) {
                var _e6 = { width: "400px", fixedcenter: true, close: false, draggable: false, zindex: 7, modal: true, visible: false
                };
                this._subscribedDialog = new YAHOO.widget.Panel("email-subscribed-dialog", _e6);
            }
            return this._subscribedDialog;
        }, startSubscribedDialog: function (_e7, _e8) {
            var _e9 = this; $D.addClass(document.body, "yui-skin-sam");
            _gaq.push(["_trackPageview", "/maillist/subscribed"]);
            showDialog();
            function showDialog() {
                var _ea = _e9.getSubscribedDialog();
                var _eb = getHelpType(_e7);
                var _ec = ["<div class=\"email-subscribed-dialog-c\">"];
                _ec.push("<h3><span id=\"email-subscribed-dialog-close\" class=\"close\">\u5173\u95ed</span></h3>");
                _ec.push("<div class=\"succ\">");
                _ec.push("<p class=\"title\">\u90ae\u4ef6\u8ba2\u9605\u6210\u529f\uff01</p>");
                if (_e8) {
                    _ec.push("<p class=\"notice\">" + _e8 + "\u6bcf\u5929\u7684\u56e2\u8d2d\u5c06\u53ca\u65f6\u53d1\u5230\u60a8\u90ae\u7bb1</p>");
                }
                _ec.push("</div>");
                _ec.push("<div class=\"setting\"><h4>\u60a8\u53ef\u80fd\u6536\u4e0d\u5230\u8ba2\u9605\u90ae\u4ef6...</h4><p class=\"text\">\u8bf7\u5c06 <strong>info@meituan.com</strong> \u52a0\u5165\u90ae\u7bb1\u767d\u540d\u5355</p>");
                if (_eb) {
                    _ec.push("<a class=\"link\" href=\"/help/email/" + _eb + "\" target=\"_blank\">\u7acb\u5373\u8fdb\u884c\u8bbe\u7f6e</a>");
                }
                _ec.push("</div>");
                _ec.push("</div>");
                _ea.setBody(_ec.join(""));
                _ea.render(document.body);
                _ea.show();
                $E.on("email-subscribed-dialog-close", "click", function (e) {
                    _ea.hide();
                });
            }
            function getHelpType(_ee) {
                var _ef = { "163.com": "163", "126.com": "126", "gmail.com": "gmail", "qq.com": "qq", "vip.qq.com": "qq", "foxmail.com": "qq", "live.com": "live", "live.cn": "live", "hotmail.com": "live", "yahoo.com.cn": "yahoo", "yahoo.cn": "yahoo", "sina.com": "sina", "vip.sina.com": "sina", "sohu.com": "sohu", "139.com": "139" };
                var _f0, key;
                if (_ee) {
                    _f0 = _ee.indexOf("@");
                    if (_f0) {
                        key = _ee.substr(_f0 + 1);
                        if (_ef[key]) {
                            return _ef[key];
                        }
                    }
                }
                return "other";
            }
        }, subscribe: function (_f2, _f3, _f4) {
            _f2 = $D.get(_f2);
            if (!_f2) {
                return;
            }
            var _f5 = _f2.email;
            var _f6 = "\u8bf7\u8f93\u5165\u60a8\u7684Email...";
            if (_f5 && _f5.value !== "") {
                _f6 = _f5.value;
            }
            if (_f5.value === "") {
                _f5.style.color = "#999999";
                _f5.value = _f6;
            }
            $E.on(_f2, "submit", function (e) {
                $E.stopEvent(e);
                if (_f5.value === "" || _f5.value === _f6) {
                    return alert("\u8bf7\u8f93\u5165\u60a8\u7684Email\u5730\u5740\u3002");
                }
                $C.setForm(_f2);
                var _f8 = $C.asyncRequest("POST", _f2.action, {
                    success: function (o) {
                        var res = MT.util.getEvalRes(o);
                        if (res.status) {
                            MT.app.Core.startSubscribedDialog(_f5.value, _f3);
                        }
                        else {
                            if (res.data && res.data.needCaptcha) {
                                window.location.href = "/maillist/subscribe/" + _f4;
                            }
                            else {
                                alert(res.msg);
                            }
                        }
                    }, failure: function (o) { }
                });
                return true;
            });
            $E.on(_f5, "focus", function (e) {
                if (_f5.value === _f6) {
                    _f5.value = "";
                }
                _f5.style.color = "#000000";
            });
            $E.on(_f5, "blur", function (e) {
                if (_f5.value === "") {
                    _f5.style.color = "#999999";
                    _f5.value = _f6;
                }
            });
        }, headerSubscribe: function () {
            var _fe = $D.get("header-city");
            if (!_fe) {
                return;
            }
            var id = _fe.getAttribute("sid");
            var name = _fe.getAttribute("sname");
            var slug = _fe.getAttribute("sslug");
            this.subscribe("header-subscribe-form", name, slug);
            this.subscribeSms("header-subscribe-sms", id, name);
        }, autoCompleteEmail: function (_102, _103) {
            if (_f(_102)) {
                _102 = $D.get(_102);
            }
            if (_f(_103)) {
                _103 = $D.get(_103);
            }
            _103.innerHTML = "<p class=\"email-title\">\u8bf7\u9009\u62e9\u60a8\u7684\u90ae\u7bb1\u7c7b\u578b...</p><ul class=\"email-list\"></ul>";
            var _104 = _103.getElementsByTagName("ul")[0];
            var _105 = ["163.com", "gmail.com", "qq.com", "126.com", "hotmail.com", "sina.com", "yahoo.com.cn", "sohu.com", "yahoo.cn", "139.com"];
            var _106 = 0;
            var _107 = 0;
            $E.on(_102, "blur", function () {
                $D.setStyle(_103, "display", "none");
            });
            $E.on(_102, "keydown", function (ev) {
                var key = ev.keyCode;
                if (key == 13) {
                    _102.value = select();
                    if ($D.getStyle(_103, "display") === "block") {
                        $D.setStyle(_103, "display", "none");
                        $E.stopEvent(ev);
                    }
                }
                else {
                    if (key == 38 || key == 40) {
                        if (ev.shiftKey == 1) {
                            return;
                        }
                        if (key == 38) {
                            if (_106 <= 0) {
                                _106 = _107;
                            }
                            _106--; selectLi(_106);
                            $E.stopEvent(ev);
                        }
                        else {
                            if (key == 40) {
                                if (_106 > _107 - 2) {
                                    _106 = -1;
                                }
                                _106++;
                                selectLi(_106);
                                $E.stopEvent(ev);
                            }
                        }
                    }
                    else {
                        window.setTimeout(function () {
                            displayList(_102);
                        }, 10);
                    }
                }
            });
            function displayList() {
                var mail = _102.value;
                var html = [];
                var _10c = "";
                var name = "";
                var _10e = mail.indexOf("@");
                if (_10e < 0) {
                    name = mail;
                }
                else {
                    if (_10e == mail.length - 1) {
                        name = mail.substr(0, _10e);
                    }
                    else {
                        name = mail.substr(0, _10e);
                        _10c = mail.substr(_10e + 1);
                    }
                }
                html.push("<li>" + mail + "</li>");
                for (var i = 0; i < _105.length; i++) {
                    var _110 = _105[i];
                    var _111 = _105[i].substr(0, _10c.length);
                    if (_10c === "" || _10c == _111) {
                        var _112 = name + "@" + _110; html.push("<li title=\"" + _112 + "\">" + _112 + "</li>");
                    }
                }
                _106 = 0; removeEvent();
                _104.innerHTML = html.join("");
                $D.setStyle(_103, "display", "block");
                attachEvent();
            }
            function removeEvent() {
                var _113 = _104.getElementsByTagName("li");
                for (var i = 0; i < _113.length; i++) {
                    var el = _113[i];
                    el.onmousedown = null;
                    el.onmouseover = null;
                    el.onmouseout = null;
                }
            }
            function attachEvent() {
                var _116 = _104.getElementsByTagName("li");
                var _117 = _116[0];
                _107 = _116.length;
                $D.addClass(_117, "current");
                for (var i = 0; i < _116.length; i++) {
                    var el = _116[i];
                    el.onmousedown = function () {
                        _102.value = this.innerHTML;
                    };
                    el.onmouseover = function () {
                        $D.removeClass(_117, "current");
                        $D.addClass(this, "current");
                    };
                    el.onmouseout = function () {
                        $D.removeClass(this, "current");
                        $D.addClass(_117, "current");
                    };
                }
            }
            function selectLi(_11a) {
                var _11b = _104.getElementsByTagName("li");
                for (var i = 0; i < _11b.length; i++) {
                    $D.removeClass(_11b[i], "current");
                }
                $D.addClass(_11b[_11a], "current");
            }
            function select() {
                var _11d = _104.getElementsByTagName("li");
                if (_11d[_106]) {
                    return _11d[_106].innerHTML;
                }
                else {
                    return _11d[0].innerHTML;
                }
            }
        }, init: function () {
            this.sysmsg();
            this.initAccountMenu();
            this.changeCity();
            this.headerSubscribe();
            this.autoCompleteEmail("header-subscribe-email", "header-subscribe-auto");
            this.trackGAEvent();
            this.msnHelp();
        }
    };
    MT.app.Core.subscribeSms = function (el, _11f, _120) {
        if (_f(el)) {
            el = $D.get(el);
        }
        if (!_120) {
            _120 = "\u7f8e\u56e2";
        }
        var _121 = "sms-subscribe-dialog";
        var _122 = MT.util.getCommonDialog(_121, { width: "400px" });
        var _123 = false;
        var _124 = "<h4>\u77ed\u4fe1\u8ba2\u9605" + _120 + "\u6bcf\u65e5\u56e2\u8d2d\u4fe1\u606f</h4><p class=\"noti\">\u8ba4\u8bc1\u7801\u5df2\u53d1\u9001\u5230\u60a8\u7684\u624b\u673a\uff1a<strong>%mobile</strong></p><p class=\"verify cf\"><label for=\"sms-subscribe-verify\">\u8ba4\u8bc1\u7801</label><input type=\"text\" id=\"sms-subscribe-verify\" class=\"f-text\" maxlength=\"20\" name=\"code\" /><span class=\"tip\">\u8bf7\u8f93\u5165\u60a8\u6536\u5230\u7684\u8ba4\u8bc1\u7801\uff0c\u5b8c\u6210\u8ba2\u9605</span></p><p class=\"act\"><input type=\"hidden\" name=\"cityid\" value=\"%cityId\" /><input type=\"hidden\" name=\"mobile\" value=\"%mobile\" /><input type=\"submit\" class=\"commit confirm\" value=\"\u53d1\u9001\" /></p>";
        var _125 = "<div class=\"succ\"><p class=\"title\">\u77ed\u4fe1\u8ba2\u9605\u6210\u529f\uff01</p><p class=\"notice\">" + _120 + "\u6bcf\u5929\u7684\u56e2\u8d2d\u4fe1\u606f\u5c06\u53ca\u65f6\u53d1\u5230\u60a8\u624b\u673a</p></div><div class=\"alert\">\u6e29\u99a8\u63d0\u793a\uff1a\u6536\u5230\u8ba2\u9605\u77ed\u4fe1\u540e\uff0c\u76f4\u63a5\u56de\u590dQX\u53ef\u53d6\u6d88\u8ba2\u9605</div>";
        $E.on(el, "click", function (e) {
            $D.addClass(document.body, "yui-skin-sam"); showDialog();
        });
        function showDialog() {
            _123 = false;
            var html = ["<div class=\"\">"];
            html.push("<h3 class=\"head\"><span class=\"close\">\u5173\u95ed</span></h3>");
            html.push("<div class=\"body\"><form id=\"sms-subscribe-form\" action=\"/mobilelist/subscribe\" method=\"post\">");
            html.push("<h4>\u77ed\u4fe1\u8ba2\u9605" + _120 + "\u6bcf\u65e5\u56e2\u8d2d\u4fe1\u606f</h4>");
            html.push("<p class=\"mobile\"><label for=\"sms-subscribe-mobile\">\u624b\u673a\u53f7</label><input type=\"text\" id=\"sms-subscribe-mobile\" class=\"f-text\" maxlength=\"20\" name=\"mobile\" value=\"\" /><span class=\"tip\">\u8bf7\u8f93\u5165\u60a8\u7684\u624b\u673a\u53f7</span></p>");
            html.push("<p class=\"enter\"><label for=\"sms-subscribe-captcha\">\u9a8c\u8bc1\u7801</label><input type=\"text\" id=\"sms-subscribe-captcha\" class=\"f-text\" maxlength=\"20\" name=\"captcha\" /><span class=\"tip\">\u6309\u4e0b\u56fe\u5b57\u7b26\u586b\u5199\uff0c\u4e0d\u533a\u5206\u5927\u5c0f\u5199</span></p>");
            html.push("<p class=\"captcha cf\"><img id=\"sms-subscribe-captcha-img\" src=\"/account/captcha?" + Math.random() + "\" width=\"100\" height=\"50\" /><span id=\"sms-subscribe-captcha-change\">\u770b\u4e0d\u6e05\u695a\uff1f\u6362\u4e00\u5f20</span></p>");
            html.push("<p class=\"act\"><input type=\"hidden\" name=\"cityid\" value=\"" + _11f + "\" /><input type=\"submit\" class=\"commit\" value=\"\u53d1\u9001\" /></p>");
            html.push("</form></div></div>");
            _122.setContent(html.join(""));
            _122.open();
            initEvent();
        }
        function initEvent() {
            $E.on("sms-subscribe-captcha-change", "click", changeCaptcha);
            $E.on("sms-subscribe-form", "submit", function (e) {
                $E.stopEvent(e);
                if (_123) {
                    var code = this.code.value;
                    if (code === "") {
                        alert("\u8bf7\u8f93\u5165\u60a8\u6536\u5230\u7684\u8ba4\u8bc1\u7801");
                        this.code.focus();
                        return false;
                    }
                    confirmVerify(this);
                }
                else {
                    var _12a = this.mobile.value;
                    var _12b = this.captcha.value;
                    if (_12a === "" || !_12a.match(/^\d{11}$/)) {
                        alert("\u8bf7\u8f93\u5165\u6b63\u786e\u768411\u4f4d\u624b\u673a\u53f7\u7801");
                        this.mobile.focus();
                        return false;
                    }
                    else {
                        if (_12b === "") {
                            alert("\u9a8c\u8bc1\u7801\u4e0d\u80fd\u4e3a\u7a7a");
                            this.captcha.focus();
                            return false;
                        }
                    }
                    sendVerify(this);
                }
                return true;
            });
        }
        function changeCaptcha() {
            var img = $D.get("sms-subscribe-captcha-img");
            var src = img.src.replace(/(\?0\.\d+)?$/, "");
            img.src = src + "?" + Math.random();
        }
        function sendVerify(_12e) {
            $C.setForm(_12e);
            var _12f = _12e.cityid.value;
            var _130 = _12e.mobile.value;
            var _131 = $C.asyncRequest("POST", "/mobilelist/subscribe", {
                success: function (o) {
                    var res = MT.util.getEvalRes(o);
                    if (res.status) {
                        if (res.data["subscribed"]) {
                            showSucc(_12e);
                        }
                        else {
                            _12e.innerHTML = _124.replace(/%cityId/g, _12f).replace(/%mobile/g, _130);
                            window.setTimeout(function () {
                                _12e.code.focus();
                            }, 100);
                            _123 = true; fixOverlay();
                        }
                    }
                    else {
                        changeCaptcha();
                        alert(res.msg);
                        _12e.captcha.focus();
                    }
                }, failure: function (o) { }
            });
        }
        function confirmVerify(_135) {
            $C.setForm(_135);
            var _136 = $C.asyncRequest("POST", "/mobilelist/verify", {
                success: function (o) {
                    var res = MT.util.getEvalRes(o);
                    if (res.status) {
                        showSucc(_135);
                    }
                    else {
                        alert(res.msg);
                        _135.code.focus();
                    }
                }, failure: function (o) { }
            });
        }
        function showSucc(_13a) {
            _13a.innerHTML = _125; fixOverlay();
        }
        function fixOverlay() {
            if (_b || (_a == 7 && document.compatMode == "BackCompat")) {
                _122.sizeUnderlay();
            }
        }
    };
    MT.app.Kaixin = (function () {
        return {
            login: function () {
                var _13b = $C.asyncRequest("POST", "/account/applogin", {
                    success: function (o) {
                        var res = MT.util.getEvalRes(o);
                        if (res.status) {
                            var url = res.data["type"] === "unbind" ? "/account/bind/kaixin001" : "/";
                            window.location.href = url;
                        }
                        else {
                            alert(res.msg);
                        }
                    }, failure: function (o) { }, timeout: 18000
                });
            }, logout: function () {
                window.location.href = "/";
            }, bind: function () {
                var _140 = $D.get("kaixin-bind-list");
                var _141 = $D.get("kaixin-bind-form");
                var _142 = $D.get("kaixin-bind-signuped");
                var _143 = $D.get("kaixin-bind-unsignuped");
                var _144 = false;
                var _145 = (function () {
                    var el = $D.hasClass(_142, "current") ? _142 : _143;
                    return $D.getElementsByClassName("textbody", "div", el)[0];
                })();
                if ($D.hasClass(_142, "current")) {
                    focus();
                }
                $E.on([_142, _143], "click", function (e) {
                    if ($D.hasClass(this, "current") || _144) {
                        return;
                    }
                    var _148 = this.getElementsByTagName("input")[0];
                    var _149 = $D.getElementsByClassName("textbody", "div", this)[0];
                    _148.checked = true;
                    $D.removeClass([_142, _143], "current");
                    $D.addClass(this, "current");
                    _144 = true;
                    var _14a = _149.getAttribute("sheight");
                    var _14b = _145.getAttribute("sheight");
                    var _14c = 0.5;
                    var ease = YAHOO.util.Easing.easeBoth;
                    var anim = new YAHOO.util.Anim(_149, {
                        height: {
                            from: 0, to: _14a
                        }
                    }, _14c, ease);
                    var _14f = new YAHOO.util.Anim(_145, {
                        height: {
                            form: _14b, to: 0
                        }
                    }, _14c, ease);
                    var _150 = this; $D.removeClass(_149, "hide");
                    $D.addClass(_145, "hide");
                    anim.onComplete.subscribe(function () {
                        var c = getBodyContent(_149);
                        _149.style.visibility = "visible";
                        if (_150 == _142) {
                            focus();
                        }
                        _144 = false;
                    }
);
                    _14f.onComplete.subscribe(function () {
                        var c = getBodyContent(_145);
                        _145.style.visibility = "hidden";
                        _145 = _149;
                        _144 = false;
                    });
                    anim.animate();
                    _14f.animate();
                });
                function getBodyContent(el) {
                    return $D.getElementsByClassName("textbody-c", "div", el)[0];
                }
                function focus() {
                    try {
                        _141.email.focus();
                    }
                    catch (e) { }
                }
            }
        };
    })();
})();